var bg = chrome.extension.getBackgroundPage();
if(bg) {
    document.write("Clicks is REAL<br>");
    document.write(bg.Clicks + "<br>");
    bg.Clicks++;
//    document.write("Clicks:" + bg.Clicks());
} else {
    document.write("Clicks is NULL");

}
bg.backgroundFunction();


var i = bg.Clicks;

    document.write("<table>");
for (; i > 0; i--) {
    document.write("<tr><td>Clicks is REAL</td><td>1212</td></tr>");

}
    document.write("</table>");

function click(e) {
    bg.Clicks = 0;
    window.close();
}
document.addEventListener('DOMContentLoaded', function () {
  var divs = document.querySelectorAll('div');
  for (var i = 0; i < divs.length; i++) {
    divs[i].addEventListener('click', click);
  }
});
